// Common response helpers
export const responseOk = ({ message, data }) => {
    return {
        error: 0,
        message: message || 'success',
        data: data
    };
};

export const responseError = ({ errorCode = -1, message = 'error' }) => {
    return {
        error: errorCode,
        message: message
    };
};

export const JSONResponseOk = (message, data) => {
    const body = {
        error: 0,
        message: message || 'success',
        data: data
    };

    return new Response(JSON.stringify(body), {
        headers: {
            'content-type': 'application/json'
        }
    });
};
